#ifndef DUOPL_MCV_DEMO_H
#define DUOPL_MCV_DEMO_H

#include <QWidget>
#include <QtGui>

class duopl_mcv_demo ;
class DuoplDemoDelegate;
class StringListModel;


class StringListModel : public QAbstractListModel
{
Q_OBJECT

public:
StringListModel(const QStringList &strings, QObject *parent = 0): QAbstractListModel(parent), stringList(strings) {}
Qt::ItemFlags flags(const QModelIndex &index) const;
bool setData(const QModelIndex &index,const QVariant &value, int role);
bool insertRows(int position, int rows, const QModelIndex &parent);
bool removeRows(int position, int rows, const QModelIndex &parent);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation,int role = Qt::DisplayRole) const;

private:
QStringList stringList;
};



class DuoplEditor:public QWidget
{
public:
    explicit DuoplEditor(QWidget *parent = 0);
    QSpinBox *spinBox;
private:
    QHBoxLayout *duopl_pMainLayout;
    QLabel *text_info;

    void paintEvent(QPaintEvent *event);
    void CreateWidget();
    void SetWidgetStyle();
    void CreateLayout();
};

class DuoplDemoDelegate : public QItemDelegate
{
Q_OBJECT

public:
DuoplDemoDelegate(QObject *parent = 0);

QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const;

void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const;

void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const;
  QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const
  {
      return QSize(100, 160);
  }
};

class duopl_mcv_demo : public QWidget
{
    Q_OBJECT
public:
    explicit duopl_mcv_demo(QWidget *parent = 0);
    
signals:
    
public slots:
    
};

#endif // DUOPL_MCV_DEMO_H
